package com.chinasoft.ecommerceconsumptionanalysissystem.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

@DS("hive")
public interface ElectronicsSaleService {
    Map<String, Object> getKPI(Date startDate, Date endDate);

    List<Map<String, Object>> getCTByDay(Date startDate, Date endDate);

    List<Map<String, Object>> getCTByWeek(String sortType, Date targetDate);

    List<Map<String, Object>> getCTByMonth(Date year);

    List<Map<String, Object>> getCTByLocalAndTime(Date startDate, Date endDate);

    List<Map<String, Object>> getCTByLocal();

    List<Map<String, Object>> getProductCombination(@Param("number") int number);

    Map<String, Object> getProductRepurchaseRate(@Param("productId") Long productId
            , @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<Map<String, Object>> getHighRepurchaseBrand(@Param("number") int number
            , @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<Map<String, Object>> getHighRepurchaseCategory(@Param("number") int number
            , @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<Map<String, Object>> detectRepeatOrderByUser(@Param("timeWindow") int timeWindow
            , @Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<Map<String, Object>> detectAbnormalHighPriceOrder(@Param("startDate") Date startDate
            , @Param("endDate") Date endDate);

    List<Map<String, Object>> detectAbnormalConsumeUser(@Param("orderCountThreshold") int orderCountThreshold
            , @Param("amountThreshold") Double amountThreshold, @Param("startDate") Date startDate
            , @Param("endDate") Date endDate);

    List<Map<String, Object>> getCategoryRatio();

    List<Map<String, Object>> getBrandShareInCategory(@Param("categoryCode") String categoryCode,
                                                      @Param("topN") int topN);

    List<Map<String, Object>> getCategoryByAgeLayer(@Param("ageLayer") String ageLayer);

    List<Map<String, Object>> getUserPowerByAgeLayer(@Param("ageLayer") String ageLayer);

    List<Map<String, Object>> getCategoryBySex(@Param("sex") String sex);

    List<Map<String, Object>> getUserPowerBySex(@Param("sex") String sex);

    List<Map<String, Object>> getCategoryByProvince(@Param("province") String province);

    List<Map<String, Object>> getUserPowerByProvince(@Param("province") String province);

}
